from rest_framework import serializers
from .models import Log


class LogSerializer(serializers.ModelSerializer):
    user = serializers.StringRelatedField(read_only=True)
    
    class Meta:
        model = Log
        fields = ['id', 'timestamp', 'level', 'source', 'message', 'user', 'details']
        read_only_fields = ['id', 'timestamp']